RCAD script
1.00
reppoutre
Textbulleup.bmp
Textbulledown.bmp
4
0
1
1er n°
Font
Size
Shape (Diamond, Circle)






1
Helvetica
18
D






Dim s_angle, s_dx, s_dy, s_Pi, s_x1, s_y1, s_x2, s_y2 as double
Dim s_TSize, s_TPoly as integer
Dim s_Fl_Asc as boolean
Dim s_LStr as String

s_Pi = 3.141592654
s_dx = lastx - firstx
s_dy = lasty - firsty
s_TSize = val(UserInput3)
s_TPoly = round(s_TSize * 1.1)
  
if s_dx <> 0 then
   s_angle = abs(Atan(s_dy / s_dx)) * 180 / s_Pi
   if s_dx >= 0 then
      if s_dy < 0 then
         s_angle = 360 - s_angle
      end if
   else
      if s_dy > 0 then
         s_angle = 180 - s_angle
      else
         s_angle = 180 + s_angle
      end if
   end if
else
   if s_dy = 0 then
      s_angle = 0
   else
      if s_dy > 0 then
         s_angle = 90
      else
         s_angle = 270
      end if
   end if
end if

if val(UserInput1) = 0 then
   s_Fl_Asc = True
else
   s_Fl_Asc = False
end if

if GlobalScript1 < 0 then
   if s_Fl_Asc then
      GlobalScript1 = Asc(UserInput1)
   else
      GlobalScript1 = Val(UserInput1)
   end if
else
   GlobalScript1 = GlobalScript1 + 1
end if

if s_Fl_Asc then
   s_LStr = Chr(GlobalScript1)
else
   s_LStr = Str(GlobalScript1)
end if

if UserInput4 = "D" then
    Add_Polygon(firstx, firsty, 0.25, 7, 0, False, False, 100, 100)

    if (s_angle < 45) or (s_angle > 315) then   //vers la droite
       Add_PointToPolygon(firstx + s_TPoly, firsty - s_TPoly)
       Add_PointToPolygon(firstx + s_TPoly * 2, firsty)
       Add_PointToPolygon(firstx + s_TPoly, firsty + s_TPoly)
       Add_PointToPolygon(firstx, firsty)
       Add_String(s_LStr,firstx+s_TPoly,firsty+s_TPoly/3,s_TSize,1,false,false,false,7,0,UserInput2,false,false,0, 100, 100)
    elseif s_angle < 135 then     //vers le bas
       Add_PointToPolygon(firstx + s_TPoly, firsty + s_TPoly)
       Add_PointToPolygon(firstx, firsty + s_TPoly * 2)
       Add_PointToPolygon(firstx - s_TPoly, firsty + s_TPoly)
       Add_PointToPolygon(firstx, firsty)
       Add_String(s_LStr,firstx,firsty+s_TPoly*1.33,s_TSize,1,false,false,false,7,0,UserInput2,false,false,0, 100, 100)
    elseif s_angle < 225 then    //vers la gauche
       Add_PointToPolygon(firstx - s_TPoly, firsty + s_TPoly)
       Add_PointToPolygon(firstx - s_TPoly * 2, firsty)
       Add_PointToPolygon(firstx - s_TPoly, firsty - s_TPoly)
       Add_PointToPolygon(firstx, firsty)
       Add_String(s_LStr,firstx-s_TPoly,firsty+s_TPoly/3,s_TSize,1,false,false,false,7,0,UserInput2,false,false,0, 100, 100)
    else    //vers le haut
       Add_PointToPolygon(firstx - s_TPoly, firsty - s_TPoly)
       Add_PointToPolygon(firstx, firsty - s_TPoly * 2)
       Add_PointToPolygon(firstx + s_TPoly, firsty - s_TPoly)
       Add_PointToPolygon(firstx, firsty)
       Add_String(s_LStr,firstx,firsty-s_TPoly+s_TPoly/3,s_TSize,1,false,false,false,7,0,UserInput2,false,false,0, 100, 100)
    end if
end if

if UserInput4 = "C" then
    s_TPoly = round(s_TPoly * 0.85)
    if (s_angle < 45) or (s_angle > 315) then   //vers la droite
       s_x1 = firstx
       s_y1 = firsty - s_TPoly
       s_x2 = firstx + s_TPoly * 2
       s_y2 = firsty + s_TPoly
    elseif s_angle < 135 then     //vers le bas
       s_x1 = firstx - s_TPoly
       s_y1 = firsty
       s_x2 = firstx + s_TPoly
       s_y2 = firsty + s_TPoly * 2
    elseif s_angle < 225 then    //vers la gauche
       s_x1 = firstx - s_TPoly * 2
       s_y1 = firsty - s_TPoly
       s_x2 = firstx
       s_y2 = firsty + s_TPoly
    else    //vers le haut
       s_x1 = firstx - s_TPoly
       s_y1 = firsty - s_TPoly * 2
       s_x2 = firstx + s_TPoly
       s_y2 = firsty
    end if
    Add_Oval(s_x1, s_y1, s_x2, s_y2, 0.25, 7, 0, False, 100, 100)
    Add_String(s_LStr, (s_x1+s_x2) / 2, (s_y1+s_y2) / 2 + s_TPoly/3, s_TSize, 1, false, false, false, 7, 0, UserInput2, false, false, 0, 100, 100)
end if

